﻿using System;

class Program
{
    static void Main()
    {
        Console.Write("请输入一个正整数：");
        int number = int.Parse(Console.ReadLine());

        Console.Write(number + "的所有素数因子为：");

        for (int i = 2; i <= number; i++)
        {
            if (number % i == 0 && IsPrime(i))
            {
                Console.Write(i + " ");
            }
        }

        Console.ReadLine();
    }

    // 判断一个数是否为素数
    static bool IsPrime(int number)
    {
        if (number <= 1)
        {
            return false;
        }

        for (int i = 2; i <= Math.Sqrt(number); i++)
        {
            if (number % i == 0)
            {
                return false;
            }
        }

        return true;
    }
}